import unittest
from pom.basedriver import BaseDriver

class BaseTestCase(unittest.TestCase):

    def tearDown(self) -> None:
        # 截图操作
        import os
        screenshots_dir = os.path.join(os.path.dirname(__file__),'../screenshots')
        if not os.path.exists(screenshots_dir):
            os.mkdir(screenshots_dir)
        import time
        finename = time.strftime('%y_%m_%d_%H_%M_%S') + '.png'
        filepath = os.path.join(screenshots_dir,finename)
        BaseDriver.save_screenshots(filepath)

    @classmethod
    def tearDownClass(cls) -> None:
        # 关闭Driver
        BaseDriver.closeDriver()